#include<iostream>
#include<cstring>
using namespace std;

char a[10000][10],tp[10];
int N,spl,count=0,x[3] = {1,0},y[3]={0,1};

void dfs(int pos,int ct){
    if(ct == spl){
        memcpy(a[count],tp,10);
        count++;
        return;
    }
    for (int i = 0; i < 2; i++)
    {
        tp[pos] += y[i];
        if(ct+y[i]<=spl&&pos+x[i]<10&&tp[pos]<='3') dfs(pos+x[i],ct+y[i]);
        tp[pos] -= y[i];
    }
}

int main()
{
    scanf("%d",&N);
    if (N>30||N<10){puts("0\n");return 0;}
    if (N==10)puts("1 1 1 1 1 1 1 1 1 1");
    spl=N-10;
    memset(tp,'1',sizeof(tp));
    dfs(0,0);
    printf("%d\n",count);
    for (int i = 0; i < count; i++)
    {
        for (int j = 0; j < 10; j++)
        {
            putchar(a[i][j]);
            putchar(' ');
        }
        putchar('\n');
    }
    return 0;
}
